#ifndef CODEEDITOR_H
#define CODEEDITOR_H

#include <QApplication>
#include <QPlainTextEdit>
#include <QCompleter>
#include <QStringListModel>
#include <QKeyEvent>
#include <QAbstractItemView>
#include <QScrollBar>

class CodeEditor : public QPlainTextEdit {
    Q_OBJECT

public:
    CodeEditor(QWidget* parent = nullptr);

protected:
    void keyPressEvent(QKeyEvent* event) override;

private slots:
    void insertCompletion(const QString& completion);

private:
    QString getCompletionPrefix() ;

    QCompleter* completer;
    QStringList keywords;
};

#endif // CODEEDITOR_H
